/**
 * 
 */
package dms.presentation.action.sys;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import dms.model.role.SystemAdministrator;
import dms.model.util.PageIterator;
import dms.service.SystemAdministratorQuerySerivce;
import dms.util.Constant;
import dms.util.ContextUtil;

/**
 * @author 李健
 *
 */
public class SAListAction extends Action {
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
	
		SystemAdministratorQuerySerivce systemAdministratorQuerySerivce = (SystemAdministratorQuerySerivce) ContextUtil.getContext().getBean("systemAdministratorQuerySerivce");
		int start;
		int count;
		try {
			start = Integer.valueOf(request.getParameter("start"));
			count = Integer.valueOf(request.getParameter("count"));
		} catch (Exception e) {
			start = Constant.START;
			count = Constant.COUNT;
		} finally {
			
		}
				
		PageIterator<SystemAdministrator> iter = systemAdministratorQuerySerivce.findAllSystemAdministrator(start, count);
		request.setAttribute("page", iter);
		
		return mapping.findForward(Constant.SUCCESS);
	}
}
